<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$daytime = mktime(0,0,0,date('m'),date('d'),date('Y'));
	$nowyue = mktime(0,0,0,date('m'),1,date('Y'));
	$yesyue = mktime(0,0,0,date('m')-1,1,date('Y'));
	$return['htmls']=array();
	if($_SESSION['isfounder'] && 0){
		//超级管理员，显示系统信息，暂不启用
		$return['htmls']=array();
	}elseif($_SESSION['user']['type']==3 ||1){
		//非超级管理员，显示站点信息
		//数据统计
		$access=array();
		$access['wechat_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>2,'createtime >'=>$daytime));
		$access['wxapp_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>1,'createtime >'=>$daytime));
		$access['mobile_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>3,'createtime >'=>$daytime));
		$access['pc_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>4,'createtime >'=>$daytime));
		$access['app_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>5,'createtime >'=>$daytime));
		$access['all_day']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'createtime >'=>$daytime));
		$access['wechat_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>2));
		$access['wxapp_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>1));
		$access['mobile_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>3));
		$access['pc_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>4));
		$access['app_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>5));
		$access['all_all']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2));
		$wxapp=array();
		$wxapp['access_day']=$access['wxapp_day'];
		$wxapp['access_mounth']=pdo_count('core_access_log',array('uniacid'=>$_SESSION['uniacid'],'this'=>2,'os'=>1,'createtime >'=>strtotime(date('ym'))));
		$wxapp['access_all']=$access['wxapp_all'];
		//当日新增粉丝
		$wxapp['fans_day']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>1,'createtime >'=>$daytime));
		//总粉丝
		$wxapp['fans_all']=pdo_count('core_fans',array('uniacid'=>$_SESSION['uniacid'],'type'=>1));
		//当日贡献会员
		$wxapp['member_day']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>1,'createtime >'=>$daytime));
		//总贡献会员
		$wxapp['member_all']=pdo_count('core_members',array('uniacid'=>$_SESSION['uniacid'],'from_os'=>1));
		//H5
		$h5appnum=pdo_count('core_account_permissions',array('uniacid'=>$_SESSION['uniacid'],'type'=>1),'id');
		//小程序
		$wxappnum=pdo_count('core_account_permissions',array('uniacid'=>$_SESSION['uniacid'],'type'=>4),'id');
		$htmls=array(				
				array('type'=>'echarts_pie','one_num'=>2,'width'=>'50%','ecid'=>'wechat','title'=>'应用数据_APP data','datas'=>array(
					'time' => date("Y-m-d H:i:s", time()),
					'datas'=>array(
						array('name'=>'H5应用','value'=>$h5appnum),
						array('name'=>'小程序应用','value'=>$wxappnum),
					),
				)),
				array('type'=>'echarts_pie','one_num'=>2,'width'=>'50%','ecid'=>'wxapp','title'=>'员工部门_Uuser data','datas'=>array(
					'time' => date("Y-m-d H:i:s", time()),
					'datas'=>array(
						array('name'=>'员工数','value'=>0),
						array('name'=>'部门数','value'=>0),
					),
				)),
				/*array('type'=>'data','tpltype'=>4,'one_num'=>4,'title'=>'站点今日/总访问数据指标_site today/all access data','datas'=>array(
					array('title'=>'公众号数据','num'=>2,'data'=>array($access['wechat_day'],$access['wechat_all'])),
					array('title'=>'小程序数据','bgcolor'=>'#009933','num'=>2,'data'=>array($access['wxapp_day'],$access['wxapp_all'])),
					array('title'=>'手机端数据','bgcolor'=>'#3366FF','num'=>2,'data'=>array($access['mobile_day'],$access['mobile_all'])),
					array('title'=>'PC端数据','bgcolor'=>'#FF3300','num'=>2,'data'=>array($access['pc_day'],$access['pc_all'])),
				)),*/
			);
		}
		$return['h5app']=$h5appnum;
		$return['wxapp']=$wxappnum;
		$return['pc']=$pc;
		set_html('title','系统后台');
		set_html('header','common/header');
		if($_SESSION['os']=='windows'){
			$return['htmls']=$htmls;
		}
		exi($return);
}
if($_RQ['op']=='getintype'){
	$intypes=get_plugin_intypes();
	$inlist=array();
	foreach($intypes as $k=>&$inv){
			if($k){
				$inlist[$k]['title']=$inv;
			}else{
				$inlist[18]['title']=$inv;
			}
	}
	foreach($inlist as $k=>&$ig){
			$groups=pdo_getall('core_account_group');
			foreach($groups as $kg=>&$gg){
				$intype=pdo_getcolumn('core_plugins',array('name'=>$gg['plugin_name']),'intype');
				if($k==$intype){
					$ig['groups'][]=$gg;
				}
			}
	}
	$return['list']=$inlist;
	exi($return);
}
if($_RQ['op']=='topwxwork'){
	$url='https://work.weixin.qq.com/';
	exi('','',$url);
}
?>